<template>
    <div>
<table class="table table-bordered">
    <tr>
        <td>用户名</td>
        <td>
            <input type="text" v-model="user.name">
        </td>
    </tr>
    <tr>
        <td>密码</td>
        <td>
            <input type="password" v-model="user.pwd">
        </td>
    </tr>
    <tr>
        <td></td>
        <td>
            <input type="button" value="登录" @click="login" class="btn btn-primary">
        </td>
    </tr>
</table>
    </div>
</template>

<script setup lang="ts">
import { ref,reactive,onMounted } from 'vue';
import axios from 'axios';
import { useRouter,useRoute } from 'vue-router';

let router=useRouter();
let route=useRoute();

let user=reactive({
    name:'',
    pwd:''
});
//测试码云
const login=()=>{
axios({
    url:'https://localhost:7002/api/Order/Login',
    params:user,
    method:'get'
})
.then(res=>{
    if(res.data>0){
alert('登录成功');
router.push('/orderAdd')
    }else{
        alert('密码错误')
    }
})
.catch(err=>{
    console.log(err);
    
})
}

</script>

<style scoped>

</style>